package main

import (
	"animal/octopus/server"
	"log"
	"os"
	"path/filepath"
	"runtime"
	"strings"
)

func main() {
	runtime.GOMAXPROCS(1)

	var dir string
	if strings.Contains(os.Args[0], "go-build") ||
		strings.Contains(os.Args[0], "go run") {
		dir = "./"
	} else {
		dir = filepath.Dir(os.Args[0])
	}

	if !server.Instance().Init(filepath.Join(dir, "config/octopus.yml")) {
		log.Fatal("init failed")
		return
	}

	server.Instance().Run()
}
